#define _CRT_SECURE_NO_WARNINGS 1

int sumOfTheDigitsOfHarshadNumber(int x)
{
    int y = x;
    int ret = 0;
    while (y)
    {
        ret += y % 10;
        y /= 10;
    }
    return x % ret == 0 ? ret : -1;
}